/*


 */

package jas.rpc.server;

/**
 * Associates server-side objects and their identifier strings. Basically a fancy two-way map.
 * 
 * IDs are used to reference remote objects through messages.
 */
public interface ObjectIdBank {
	/**
	 * Returns the ID for the specified object. If the object had no ID,
	 * a generic ID will be generated for it. If an ID is generated, the
	 * bank will be modified to contain the new binding.
	 * 
	 * @param obj the object whose ID is needed.
	 * @return the object's ID
	 */
    String getId(Object obj);
    
    /**
     * Returns the object with the specified ID.
     * @param id identifier of the wanted object
     * @return object with the specified identifier
     */
    Object getObjectWithId(String id);
    
    /**
     * Associates the specified ID and object.
     * @param id an identifier for the object
     * @param o the object to be identified by <code>id</code>
     */
    void bind(String id, Object o);
}
